﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.DataCollection.OperationCore.AbstractFactory.SpecificFactory;
using ZR.DataCollection.OperationCore.OperationEnum;
using ZR.DataCollection.OperationCore.ExtensionMethod;

namespace ZR.DataCollection.OperationCore.AbstractFactory
{
    public class IAbsFactory
    {
        private static readonly Lazy<IAbsFactory> _lazy = new Lazy<IAbsFactory>(() => new IAbsFactory());
        public static IAbsFactory Current => _lazy.Value;

        /// <summary>
        /// 获取工站
        /// </summary>
        /// <param name="station">名义顺序</param>
        /// <returns></returns>
        public IAbsStationFactory GetStationFactory(string station)
        {
            var stationNo = station.StationInfoByItem();
            switch (stationNo)
            {
                case StationEnum.StationDefalut:
                    return new IDefalutFactory(station);

                case StationEnum.StationZero:
                    return new IStationOP10Factory(station);

                case StationEnum.StationOne:
                    return new IStationOP10Factory(station);

                case StationEnum.StationTwo:
                    return new IStationOP20Factory(station);

                case StationEnum.StationThree:
                    return new IStationOP30Factory(station);

                case StationEnum.StationFour:
                    return new IStationOP40Factory(station);

                case StationEnum.StationFive:
                    return new IStationST05Factory(station);

                case StationEnum.StationSix:
                    return new IStationST06Factory(station);

                case StationEnum.StationSeven:
                    return new IStationST07Factory(station);

                case StationEnum.StationEight:
                    return new IStationST08Factory(station);

                default:
                    return null;
            }
        }
    }
}